package com.deng.framework.context.support;

import com.deng.framework.beans.factory.support.DefaultListableBeanFactory;
import com.deng.framework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * 对配置信息的加载的抽象类
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext{
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        //这里是依赖了XmlBeanDefinitionReader，将我们的beanFactory和自身（继承了DefaultResourceLoader，可以视为一个自定义的ResourceLoader）作为参数传入进去
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations){
            //进行bean的注册
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();
}
